<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-09 10:07:06
 * @LastEditTime: 2019-10-21 16:52:34
 * @LastEditors: Please set LastEditors
 -->
<template>
  <div class="mine animated bounceInRight">
    <content class="content">
      <header class="header">
        <p>{{text_title}}</p>
      </header>
      <div class="marquee">
        <img src="../../assets/bi.png" alt>
        <div class="marquee_box">
          <ul class="marquee_list" :class="{marquee_top:animate}" @click="saying">
            <li v-for="(item,index) in marqueeList" :key="index">{{item.name}}</li>
          </ul>
        </div>
        <div class="marquee_dian"></div>
      </div>
      <div class="sj">
        <ul>
          <li>
            <img src="../../assets/r_no.png" @click="r_no_c" v-if="r_no" alt>
            <img src="../../assets/r_ok.png" v-if="!r_no" alt>
            <p :class="rbao_no?'text_r':'text_r2'">日报</p>
          </li>
          <li>
            <img src="../../assets/yue_no.png" @click="yue_no_c" v-if="yue_no" alt>
            <img src="../../assets/yue_ok.png" v-if="!yue_no" alt>
            <p :class="rbaoa_no?'text_r':'text_r2'">月报</p>
          </li>
          <li>
            <img src="../../assets/nian_no.png" @click="nian_no_c" v-if="nian_no" alt>
            <img src="../../assets/nian_ok.png" v-if="!nian_no" alt>
            <p :class="rbaob_no?'text_r':'text_r2'">年报</p>
          </li>
        </ul>
      </div>
      <div style="height:0.1rem;background:#EEEEEE;"></div>
      <div class="list_a">
        <ul>
          <li @click="play_list">
            <div class="diva">
              部门
              <span @click.stop>
                <img src="../../assets/push.png" @click="play_list" alt>
                <img
                  :src="null_a?require('../../assets/null_no.png'):require('../../assets/null_ok.png')"
                  @click="play_list_null"
                  alt
                >
              </span>
            </div>
            <div class="divb">
              <div v-for="(i,index) in li_list_1" :key="index" @click.stop>
                {{i.name}}
                <img src="../../assets/clear.png" @click="img_a(index)">
              </div>
            </div>
            <div class="divb">
              <div v-for="(i,index) in li_list_3" :key="index" @click.stop>
                {{i.name}}
                <img src="../../assets/clear.png" @click="img_c(index)">
              </div>
            </div>
          </li>
          <li @click="play_list_product">
            <div class="diva">
              产品
              <span @click.stop>
                <img src="../../assets/push.png" @click="play_list_product" alt>
                <img
                  :src="null_b?require('../../assets/null_no.png'):require('../../assets/null_ok.png')"
                  @click="play_listtwo_null"
                  alt
                >
              </span>
            </div>
            <div class="divb">
              <div v-for="(i,index) in li_list_2" :key="index" @click.stop>
                {{i.name}}
                <img src="../../assets/clear.png" @click="img_b(index)">
              </div>
            </div>
            <div class="divb">
              <div v-for="(i,index) in li_list_4" :key="index" @click.stop>
                {{i.name}}
                <img src="../../assets/clear.png" @click="img_d(index)">
              </div>
            </div>
          </li>
          <!-- <li @click="play_list_staff">
            <div class="diva">
              人员
              <span @click.stop>
                <img src="../../assets/push.png" @click="play_list_staff" alt>
                <img
                  :src="null_c?require('../../assets/null_no.png'):require('../../assets/null_ok.png')"
                  @click="play_listthree_null"
                  alt
                >
              </span>
            </div>
            <div class="divb">
              <div v-for="(i,index) in li_list_3" :key="index" @click.stop>
                {{i.value}}
                <img src="../../assets/clear.png" @click="img_c(index)">
              </div>
            </div>
          </li>-->
        </ul>
      </div>
      <mt-popup v-model="popupVisible" position="bottom" class="bottom_mode">
        <div class="title">
          <p class="text_1" @click="btn_close">
            <img src="../../assets/shut.png" alt>
          </p>
          <p class="text_2">单选</p>
          <p class="text_3" @click="btn_sure">确定</p>
        </div>
        <div class="text_content">
          <ul>
            <li
              v-for="(i,index) in text_tit"
              :class="{active:i_display==index}"
              :key="index"
              @click="text_dian(index)"
            >{{i.a}}</li>
          </ul>
        </div>
      </mt-popup>
      <div
        ref="move_div"
        @touchstart="down"
        @touchmove="move"
        @touchend="end"
        :style="{top: top  + 'px', left: left  + 'px'}"
        class="fish_box"
      >
        <div :class="[zhuan?'generate_a no':'generate_a ok']" @click="fish"></div>
        <div class="text_no1" @click="fish"></div>
      </div>
    </content>
    <div class="footer">
      <div class="out_1" @click="home">
        <div class="in_1">
          <img src="../../assets/home_left.png">
          <p style="color:#A9A9A9;">首页</p>
        </div>
      </div>
      <div class="out_1">
        <div class="in_1" @click="sala">
          <div class="modela">
            <img src="../../assets/ding.png">
          </div>
          <p style="margin-top:0.3rem;color:#E3C09D">功能</p>
        </div>
      </div>
      <div class="out_1">
        <div class="in_1" @click="mine">
          <img src="../../assets/home_right.png">
          <p style="color:#A9A9A9">我的</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  query_ent_dept_list,   //部门列表
  query_category_info_list,
  get_staff_list,
  get_con_daily,
  check_login,
  get_con_month,
  get_con_year,
  get_inv_daily,
  get_inv_month,
  get_inv_year,
  get_rec_daily,
  get_rec_month,
  get_rec_year,
} from "../../api/api.js";
import { Toast, MessageBox } from "mint-ui";
import { reject } from "q";
export default {
  name: "mine",
  // inject: ["reload"],
  data() {
    return {
      animate: false,
      marqueeList: [
        {
          name: "与“宇宙的意志”相协调"
        },
        {
          name: "爱、真诚以及和谐的之心"
        },
        {
          name: "以纯洁的心灵来描绘愿望"
        },
        {
          name: "拥有坦诚之心"
        },
        {
          name: "必须经常保持谦虚"
        },
        {
          name: "怀有感谢之心"
        },
        {
          name: "保持乐观开朗"
        },
        {
          name: "为伙伴尽力"
        },
        {
          name: "构筑信赖关系"
        },
        {
          name: "贯彻完美主义"
        },
        {
          name: "认真努力，埋头苦干"
        },
        {
          name: "脚踏实地，坚持不懈"
        },
        {
          name: "自我燃烧"
        },
        {
          name: "爱上工作"
        },
        {
          name: "探究事物的本质"
        },
        {
          name: "成为漩涡的中心"
        },
        {
          name: "率先垂范"
        },
        {
          name: "把自己逼入绝境"
        },
        {
          name: "在相扑台的中央发力"
        },
        {
          name: "直言相谏"
        },
        {
          name: "戒除私心才能正确判断"
        },
        {
          name: "具备均衡的人格"
        },
        {
          name: "实践重于知识"
        },
        {
          name: "要不断从事创造性的工作"
        },
        {
          name: "把利他之心作为判断基准"
        },
        {
          name: "大胆与细心兼备"
        },
        {
          name: "以‘有意注意’磨炼判断力"
        },
        {
          name: "贯彻公平竞争的精神"
        },
        {
          name: "注重公私分明"
        },
        {
          name: "怀有渗透到潜意识的、强烈而持久的愿望"
        },
      ],
      popupVisible: false,
      text_title: "",
      i_display: 0,
      text_tit: [{ a: "合同" }, { a: "发票" }, { a: "回款" }],
      li_list_1: [],
      li_list_2: [],
      li_list_3: [],
      li_list_4:[],
      text_tit_a: "",
      zhuan: false,
      flags: false,
      // 拖拽鱼
      position: { x: 0, y: 0, left: 0, top: 0 },
      top: 2.4 + "rem",
      left: 1.02 + "rem",
      width:
        window.innerWidth ||
        document.documentElement.clientWidth ||
        document.body.clientWidth,
      height:
        window.innerHeight ||
        document.documentElement.clientHeight ||
        document.body.clientHeight,
      //日期
      r_no: false,
      zhou_no: true,
      yue_no: true,
      ji_no: true,
      ban_no: true,
      nian_no: true,
      text_time: "日",
      show: true,
      sj: "",
      null_a: true,
      null_b: true,
      null_c: true,
      prod_id: [],
      staff_id: [],
      dept_id: "",
      ent_id: [],
      cat_id:[],
      rbao_no: false,
      rbaoa_no: true,
      rbaob_no: true,
      list: [],
      text_title_a:'合同'
    };
  },
  created: function() {
    setInterval(this.showMarquee, 4000);
  },
  mounted() {
    if (sessionStorage.getItem("text_title") != null&&sessionStorage.getItem("text_title") != undefined) {
      this.text_title = JSON.parse(sessionStorage.getItem("text_title"));
      if(this.text_title=='合同'){
        this.i_display=0
      }else if(this.text_title=='发票'){
        this.i_display=1
      }else if(this.text_title=='回款'){
        this.i_display=2
      }
    }
    // 判断是否登录
    if (sessionStorage.getItem("mobile") != null) {
      this.mobile = JSON.parse(sessionStorage.getItem("mobile"));
    }

    check_login({
      data: {
        mobile: this.mobile
      }
    }).then(res => {
      if (res.data.code == 11001) {
      } else if (res.data.code == 11000) {
        this.$toast("未登录，请重新登录");
        this.$router.push("/");
      }
    });
    if (sessionStorage.getItem("mlbb_xinxi") != null) {
      this.dept_id =JSON.parse(sessionStorage.getItem("mlbb_xinxi")).ent_id;
    }
    console.log(this.dept_id);
    if (sessionStorage.getItem("xuan") != null) {
      this.li_list_1 = JSON.parse(sessionStorage.getItem("xuan"));
    }
    if (sessionStorage.getItem("xuan_two") != null) {
      this.li_list_2 = JSON.parse(sessionStorage.getItem("xuan_two"));
    }
    if (sessionStorage.getItem("xuan_three") != null) {
      this.li_list_3 = JSON.parse(sessionStorage.getItem("xuan_three"));
    }
    if (sessionStorage.getItem("xuan_four") != null) {
      this.li_list_4 = JSON.parse(sessionStorage.getItem("xuan_four"));
    }

    console.log(9999, this.list);
  },
  watch: {
    li_list_1() {
      if (this.li_list_1.length == 0) {
        if (this.li_list_3.length > 0) {
          this.null_a = false;
        } else if (this.li_list_3.length == 0) {
          this.null_a = true;
        }
      } else if (this.li_list_1.length > 0) {
        this.null_a = false;
      }
    },
    li_list_2() {
      if (this.li_list_2.length == 0) {
        if (this.li_list_4.length > 0) {
          this.null_b = false;
        } else if (this.li_list_4.length == 0) {
          this.null_b = true;
        }
      } else if (this.li_list_2.length > 0) {
        this.null_b = false;
      }
    },
    li_list_3() {
      if (this.li_list_3.length == 0) {
        if (this.li_list_1.length > 0) {
          this.null_a = false;
        } else if (this.li_list_1.length == 0) {
          this.null_a = true;
        }
      } else if (this.li_list_3.length > 0) {
        this.null_a = false;
      }
    },
    li_list_4() {
      if (this.li_list_2.length == 0) {
        if (this.li_list_4.length > 0) {
          this.null_b = false;
        } else if (this.li_list_4.length == 0) {
          this.null_b = true;
        }
      } else if (this.li_list_2.length > 0) {
        this.null_b = false;
      }
    },
  },
  methods: {
    showMarquee: function() {
      this.animate = true;
      setTimeout(() => {
        this.marqueeList.push(this.marqueeList[0]);
        this.marqueeList.shift();
        this.animate = false;
      }, 500);
    },
    home() {
      this.$router.push("/home");
    },
    mine() {
      this.$router.push("/mine");
    },
    sala() {
      this.popupVisible = true;
    },
    btn_close() {
      this.popupVisible = false;
    },
    btn_sure() {
      if (
        this.li_list_1.length == 0 &&
        this.li_list_2.length == 0 &&
        this.li_list_3.length == 0&&
        this.li_list_4.length == 0
      ) {
        this.$toast("已默认全部选择");
      }
      this.popupVisible = false;
      this.text_title = this.text_title_a;
      console.log(this.text_title)
      sessionStorage.setItem("text_title", JSON.stringify(this.text_title));
    },
    // 点击功能字体
    text_dian(i) {
      this.text_title_a = this.text_tit[i].a;
      this.i_display = i;
    },
    // 旋转鱼
    fish() {
      //登录id
      if (this.dept_id == "") {
        this.dept_id = null;
      } else if (this.dept_id.length > 0) {
        console.log(222, this.dept_id);
      }
      //部门id
      if (this.li_list_1.length == 0) {
        this.ent_id = null;
      } else if (this.ent_id == "") {
        for (var i = 0; i < this.li_list_1.length; i++) {
          this.ent_id.push(this.li_list_1[i].id);
        }
        if (this.li_list_1.constructor === Array) {
          this.ent_id = this.ent_id.join(",");
        }
      }
      // 人员id
      if (this.li_list_3.length == 0) {
        this.staff_id = null;
      } else if (this.staff_id == "") {
        for (var i = 0; i < this.li_list_3.length; i++) {
          this.staff_id.push(this.li_list_3[i].id);
        }
        if (this.li_list_3.constructor === Array) {
          this.staff_id = this.staff_id.join(",");
        }
      }
      // 产品id
      if (this.li_list_2.length == 0) {
        this.prod_id = null;
      } else if (this.prod_id == "") {
        for (var i = 0; i < this.li_list_2.length; i++) {
          this.prod_id.push(this.li_list_2[i].id);
        }
        if (this.li_list_2.constructor === Array) {
          this.prod_id = this.prod_id.join(",");
        }
      }
      // 产品类型id
      if (this.li_list_4.length == 0) {
        this.cat_id = null;
      } else if (this.cat_id == "") {
        for (var i = 0; i < this.li_list_4.length; i++) {
          this.cat_id.push(this.li_list_4[i].id);
        }
        if (this.li_list_4.constructor === Array) {
          this.cat_id = this.cat_id.join(",");
        }
      }
      if (this.text_title == "") {
        this.$toast("请选择下方的功能");
      } else {
        if (this.text_title == "合同" && this.text_time == "日") {
          this.zhuan = true;
          get_con_daily({
            data: {
              ent_id: this.dept_id, //企业与部门id写反了
              dept_id: this.ent_id,
              staff_id: this.staff_id,
              prod_id: this.prod_id,
              cat_id: this.cat_id,
            }
          }).then(res => {
            console.log(res);
            if (res.data.code == 10033) {
              sessionStorage.setItem(
                "date_list",
                JSON.stringify(res.data.body.data)
              );
              sessionStorage.setItem("r_xian", JSON.stringify(1));
              this.dao();
            } else if (res.data.code == 10034) {
              this.$toast("合成失败");
              this.zhuan = false;
            } else if (res.data.code == 10035) {
              this.$router.push("/nodata");
            }
          });
        } else if (this.text_title == "回款" && this.text_time == "日") {
          this.zhuan = true;
          get_rec_daily({
            data: {
              ent_id: this.dept_id, //企业与部门id写反了
              dept_id: this.ent_id,
              staff_id: this.staff_id,
              prod_id: this.prod_id,
              cat_id: this.cat_id,
              est_type:'1'
            }
          }).then(res => {
            console.log(res);
            if (res.data.code == 10052) {
              sessionStorage.setItem(
                "date_list",
                JSON.stringify(res.data.body.data)
              );
              sessionStorage.setItem("r_xian", JSON.stringify(1));
              sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
              this.dao();
            } else if (res.data.code == 10053) {
              this.$toast("合成失败");
              this.zhuan = false;
            } else if (res.data.code == 10054) {
              this.$router.push("/nodata");
            }
          });
        } else if (this.text_title == "发票" && this.text_time == "日") {
          this.zhuan = true;
          get_inv_daily({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
            est_type:'1'
          }}).then(res=>{
            console.log(res)
            if(res.data.code==10043){
              sessionStorage.setItem(
                "date_list_fapiao_r",
                JSON.stringify(res.data.body.data)
              );
              sessionStorage.setItem("fa_r_xian", JSON.stringify(1));
              sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
              this.dao()
            }else if(res.data.code==10044){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10045){
              this.$router.push("/nodata");
            }
          })
        } else if (this.text_title == "合同" && this.text_time == "月") {
          this.zhuan = true;
          get_con_month({
              data: {
                ent_id: this.dept_id, //企业与部门id写反了
                dept_id: this.ent_id,
                staff_id: this.staff_id,
                prod_id: this.prod_id,
                cat_id: this.cat_id,
              }
          }).then(res => {
            console.log(res);
            if (res.data.code == 10036) {
              sessionStorage.setItem(
                "date_list_yue",
                JSON.stringify(res.data.body.data)
              );
              get_con_daily({
                data: {
                  ent_id: this.dept_id, //企业与部门id写反了
                  dept_id: this.ent_id,
                  staff_id: this.staff_id,
                  prod_id: this.prod_id,
                  cat_id: this.cat_id,
                }
              }).then(res => {
                console.log(res);
                if (res.data.code == 10033) {
                  sessionStorage.setItem(
                    "date_list",
                    JSON.stringify(res.data.body.data)
                  );
                  this.dao()
                  sessionStorage.setItem("yue_xian", JSON.stringify(1));
                  // sessionStorage.setItem("true_a", JSON.stringify(0));
                } else if (res.data.code == 10034) {
                  this.$toast("合成失败");
                  this.zhuan = false;
                } else if (res.data.code == 10035) {
                  this.$router.push("/nodata");
                }
              });
              // sessionStorage.setItem("true_a", JSON.stringify(0));
              // this.dao();
            } else if (res.data.code == 10037) {
              this.$toast("合成失败");
              this.zhuan = false;
            } else if (res.data.code == 10038) {
              this.$router.push("/nodata");
            }
          });
          // this.$router.push('/monthly')
        } else if (this.text_title == "回款" && this.text_time == "月") {
          this.zhuan = true;
          get_rec_month({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
            est_type:'1'
          }}).then(res=>{
            if(res.data.code==10055){
              sessionStorage.setItem('date_fa_yue',JSON.stringify(res.data.body.data))
              get_rec_daily({data:{
                ent_id: this.dept_id, //企业与部门id写反了
                dept_id: this.ent_id,
                staff_id: this.staff_id,
                prod_id: this.prod_id,
                cat_id: this.cat_id,
                est_type:'1'
              }}).then(res=>{
                console.log(res)
                if(res.data.code==10052){
                  sessionStorage.setItem(
                    "date_list_fapiao_r",
                    JSON.stringify(res.data.body.data)
                  );
                  sessionStorage.setItem("fa_yue_xian", JSON.stringify(1));
                  sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
                  this.dao()
                }else if(res.data.code==10053){
                  this.$toast("合成失败");
                  this.zhuan = false;
                }else if(res.data.code==10054){
                  this.$router.push("/nodata");
                }
              })
            }else if(res.data.code==10056){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10057){
              this.$router.push("/nodata");
            }
          })
        } else if (this.text_title == "发票" && this.text_time == "月") {
          this.zhuan = true;
          get_inv_month({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
            est_type:'1'
          }}).then(res=>{
            if(res.data.code==10046){
              sessionStorage.setItem('date_fa_yue',JSON.stringify(res.data.body.data))
              get_inv_daily({data:{
                ent_id: this.dept_id, //企业与部门id写反了
                dept_id: this.ent_id,
                staff_id: this.staff_id,
                prod_id: this.prod_id,
                cat_id: this.cat_id,
                est_type:'1'
              }}).then(res=>{
                console.log(res)
                if(res.data.code==10043){
                  sessionStorage.setItem(
                    "date_list_fapiao_r",
                    JSON.stringify(res.data.body.data)
                  );
                  sessionStorage.setItem("fa_yue_xian", JSON.stringify(1));
                  sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
                  this.dao()
                }else if(res.data.code==10044){
                  this.$toast("合成失败");
                  this.zhuan = false;
                }else if(res.data.code==10045){
                  this.$router.push("/nodata");
                }
              })
            }else if(res.data.code==10047){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10048){
              this.$router.push("/nodata");
            }
          })
        } else if (this.text_title == "合同" && this.text_time == "年") {
          this.zhuan = true;
          get_con_year({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
          }}).then(res=>{
            if(res.data.code==10039){
              sessionStorage.setItem('nian_xian',JSON.stringify(res.data.body.data))
              sessionStorage.setItem("nian2_xian", JSON.stringify(1));
              this.dao()
            }else if(res.data.code==10040){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10041){
              this.$router.push("/nodata");
            }
          })
          // sessionStorage.setItem('nian_xian',JSON.stringify("{\"x_axis\":[\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"1\",\"2\"],\"amt_con_sum\":1850.0000,\"amt_con_sum_est\":1250.0000,\"amt_con_sum_should\":2440.0000,\"amt_aim\":3660.0000,\"amt_avg_aim\":305.0000,\"in_blue\":1850.0000,\"in_red\":560.0000,\"in_violet\":1250.0000,\"out_blue\":1850.0000,\"out_red\":590.0000,\"out_green\":0,\"out_orange\":1220.0000,\"out_yellow\":0,\"con_year_list\":[{\"amt_con_sum\":200.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":200.0000,\"out_red\":110.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201903\"},{\"amt_con_sum\":150.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":150.0000,\"out_red\":160.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201904\"},{\"amt_con_sum\":100.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":100.0000,\"out_red\":210.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201905\"},{\"amt_con_sum\":200.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":200.0000,\"out_red\":110.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201906\"},{\"amt_con_sum\":150.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":150.0000,\"out_red\":160.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201907\"},{\"amt_con_sum\":300.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":300.0000,\"out_red\":10.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201908\"},{\"amt_con_sum\":400.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":310.0000,\"out_red\":0,\"out_green\":90.0000,\"out_orange\":0,\"out_yellow\":0,\"out_violet\":0,\"the_month\":\"201909\"},{\"amt_con_sum\":350.0000,\"amt_con_sum_est\":150.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":310.0000,\"out_red\":0,\"out_green\":40.0000,\"out_orange\":0,\"out_yellow\":150.0000,\"out_violet\":0,\"the_month\":\"201910\"},{\"amt_con_sum_est\":200.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":0,\"out_red\":110.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"amt_aim_tow\":457.5000,\"out_violet\":310.0000,\"the_month\":\"201911\"},{\"amt_con_sum_est\":350.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":0,\"out_red\":0,\"out_green\":0,\"out_orange\":0,\"out_yellow\":40.0000,\"amt_aim_tow\":457.5000,\"out_violet\":310.0000,\"the_month\":\"201912\"},{\"amt_con_sum_est\":300.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":0,\"out_red\":10.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"amt_aim_tow\":457.5000,\"out_violet\":310.0000,\"the_month\":\"202001\"},{\"amt_con_sum_est\":250.0000,\"amt_aim\":310.0000,\"in_blue\":0,\"in_red\":0,\"in_violet\":0,\"out_blue\":0,\"out_red\":60.0000,\"out_green\":0,\"out_orange\":0,\"out_yellow\":0,\"amt_aim_tow\":457.5000,\"out_violet\":310.0000,\"the_month\":\"202002\"}],\"current_month_num\":8,\"amt_avg_have\":231.2500,\"amt_gap_avg\":147.5000,\"year_first_date\":\"20190301\",\"year_last_date\":\"20200229\"}"))
          // this.$router.push('/annual')
        } else if (this.text_title == "回款" && this.text_time == "年") {
          this.zhuan = true;
          get_rec_year({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
            est_type:'1'
          }}).then(res=>{
            if(res.data.code==10058){
              sessionStorage.setItem('nian_xian',JSON.stringify(res.data.body.data))
              sessionStorage.setItem("nian2_xian", JSON.stringify(1));
              sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
              this.dao()
            }else if(res.data.code==10059){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10060){
              this.$router.push("/nodata");
            }
          })
        } else if (this.text_title == "发票" && this.text_time == "年") {
          this.zhuan = true;
          get_inv_year({data:{
            ent_id: this.dept_id, //企业与部门id写反了
            dept_id: this.ent_id,
            staff_id: this.staff_id,
            prod_id: this.prod_id,
            cat_id: this.cat_id,
            est_type:'1'
          }}).then(res=>{
            if(res.data.code==10049){
              sessionStorage.setItem('nian_xian',JSON.stringify(res.data.body.data))
              sessionStorage.setItem("nian2_xian", JSON.stringify(1));
              sessionStorage.setItem("fang_r_xian", JSON.stringify(1));
              this.dao()
            }else if(res.data.code==10050){
              this.$toast("合成失败");
              this.zhuan = false;
            }else if(res.data.code==10051){
              this.$router.push("/nodata");
            }
          })
        }
        // this.dao();
      }
    },
    down() {
      // 拖动开始的操作
      this.flags = true;
      const refs = this.$refs.move_div.getBoundingClientRect();
      let touch = event;
      if (event.touches) {
        touch = event.touches[0];
      }
      this.position.x = touch.clientX;
      this.position.y = touch.clientY;
      this.position.left = refs.left;
      this.position.top = refs.top;
    },
    move() {
      // 拖动中的操作
      if (this.flags) {
        let touch = event;
        if (event.touches) {
          touch = event.touches[0];
        }
        const xPum = this.position.left + touch.clientX - this.position.x;
        const yPum = this.position.top + touch.clientY - this.position.y;
        this.left = xPum;
        this.top = yPum;
        this.banOut();
        // 阻止页面的滑动默认事件
        document.addEventListener(
          "touchmove",
          function() {
            event.preventDefault();
          },
          { passive: false }
        );
      }
    },
    end() {
      // 拖动结束的操作
      this.flags = false;
      this.banOut();
    },
    banOut() {
      // 避免拖动出界的限制
      const refs = this.$refs.move_div.getBoundingClientRect();
      if (this.left < 0) {
        this.left = 0;
      } else if (this.left > this.width - refs.width) {
        this.left = this.width - refs.width;
      }
      if (this.top < 0) {
        this.top = 0;
      } else if (this.top > this.height - refs.height) {
        this.top = this.height - refs.height;
      }
    },
    // 日期
    r_no_c() {
      this.r_no = false;
      this.yue_no = true;
      this.nian_no = true;
      this.text_time = "日";
      this.rbao_no = false;
      this.rbaoa_no = true;
      this.rbaob_no = true;
    },
    yue_no_c() {
      this.r_no = true;
      this.yue_no = false;
      this.nian_no = true;
      this.text_time = "月";
      this.rbao_no = true;
      this.rbaoa_no = false;
      this.rbaob_no = true;
    },
    nian_no_c() {
      this.r_no = true;
      this.yue_no = true;
      this.nian_no = false;
      this.text_time = "年";
      this.rbao_no = true;
      this.rbaoa_no = true;
      this.rbaob_no = false;
    },
    //   倒计时
    dao() {
      this.show = false;
      const TIME_COUNT = 1;
      if (!this.timer) {
        this.sj = TIME_COUNT;
        this.show = false;
        this.timer = setInterval(() => {
          if (this.sj > 0 && this.sj <= TIME_COUNT) {
            this.sj--;
          } else {
            this.show = true;
            clearInterval(this.timer);
            this.timer = null;
            Toast("生成成功");
            if (this.text_title == "合同" && this.text_time == "日") {
              this.$router.push("/synthesis");
            } else if (this.text_title == "回款" && this.text_time == "日") {
              this.$router.push('/recr')
            } else if (this.text_title == "发票" && this.text_time == "日") {
              this.$router.push('/arrivalmoneyr')
            } else if (this.text_title == "合同" && this.text_time == "月") {
              this.$router.push("/monthly");
            } else if (this.text_title == "回款" && this.text_time == "月") {
              this.$router.push('/recyue')
            } else if (this.text_title == "发票" && this.text_time == "月") {
              this.$router.push('/invmo')
            } else if (this.text_title == "合同" && this.text_time == "年") {
              this.$router.push('/annual')
            } else if (this.text_title == "回款" && this.text_time == "年") {
              this.$router.push('/recnian')
            } else if (this.text_title == "发票" && this.text_time == "年") {
              this.$router.push('/invann')
            }
          }
        }, 1000);
      }
    },
    // 部门接口
    play_list() {
      this.$loading.open();
      query_ent_dept_list({
        data: {
          parent_id: "0",
          ent_id: this.dept_id,
          active:'1'
        }
      }).then(res => {
        this.$loading.close();
        console.log(res);
        if (res.data.code == 10168) {
          this.$router.push("/depalist");
        } else if (res.data.code == 10169) {
          this.$toast("获取列表失败");
        }
      });
    },
    // 产品接口
    play_list_product() {
      this.$loading.open();
      query_category_info_list({
        data: {
          ent_id:this.$ent_id(),
          parent_id:'0',
          active:'1'
        }
      }).then(res => {
        this.$loading.close();
        if (res.data.code == 10193) {
          this.$router.push("/prodlist");
        } else if (res.data.code == 10194) {
          this.$toast("获取列表失败");
        }
      });
    },
    img_a(i) {
      // console.log(i);
      this.li_list_1.splice(i, 1);
      sessionStorage.setItem("xuan", JSON.stringify(this.li_list_1));
    },
    img_b(i) {
      // console.log(i);
      this.li_list_2.splice(i, 1);
      sessionStorage.setItem("xuan_two", JSON.stringify(this.li_list_2));
    },
    img_c(i) {
      // console.log(i);
      this.li_list_3.splice(i, 1);
      sessionStorage.setItem("xuan_three", JSON.stringify(this.li_list_3));
    },
    img_d(i) {
      // console.log(i);
      this.li_list_4.splice(i, 1);
      sessionStorage.setItem("xuan_four", JSON.stringify(this.li_list_4));
    },
    // 部门全删
    play_list_null() {
      if (this.null_a == false) {
        MessageBox.confirm("", {
          message: "将清除该项全部选择条件",
          title: "确认清除",
          showConfirmButton: true,
          showCancelButton: true,
          cancelButtonClass: "cancelButton",
          confirmButtonClass: "confirmButton",
          confirmButtonText: "确定",
          cancelButtonText: "暂不"
        })
          .then(action => {
            if (action == "confirm") {
              this.li_list_1 = [];
              this.li_list_3 = [];
              // location.reload();
              sessionStorage.setItem(
                "xuan_three",
                JSON.stringify(this.li_list_3)
              );
              sessionStorage.setItem("xuan", JSON.stringify(this.li_list_1));
              //点击确定的回调
              // console.log("abc");
              Toast("操作成功");
            }
          })
          .catch(err => {
            if (err == "cancel") {
              //点击暂不的回调
              // Toast('')
            }
          });
      }
    },
    // 产品全删
    play_listtwo_null() {
      if (this.null_b == false) {
        MessageBox.confirm("", {
          message: "将清除该项全部选择条件",
          title: "确认清除",
          showConfirmButton: true,
          showCancelButton: true,
          cancelButtonClass: "cancelButton",
          confirmButtonClass: "confirmButton",
          confirmButtonText: "确定",
          cancelButtonText: "暂不"
        })
          .then(action => {
            if (action == "confirm") {
              this.li_list_2 = [];
              this.li_list_4=[];
              sessionStorage.setItem(
                "xuan_two",
                JSON.stringify(this.li_list_2)
              );
              sessionStorage.setItem(
                "xuan_four",
                JSON.stringify(this.li_list_4)
              );
              //点击确定的回调
              // console.log("abc");
              Toast("操作成功");
            }
          })
          .catch(err => {
            if (err == "cancel") {
              //点击暂不的回调
              // Toast('')
            }
          });
      }
    },
    saying(){
      this.$router.push('/saying')
    }
    // 人员全删
    // play_listthree_null() {
    //   this.li_list_3 = [];
    //   sessionStorage.setItem("xuan_three", JSON.stringify(this.li_list_3));
    // }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.mine {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fbf8f8;
  position: relative;
  .marquee {
    display: flex;
    align-items: center;
    height: 0.35rem;
    background-color: #fff;
    padding: 0 0.16rem;
    margin-top: 0.08rem;
    position: relative;
    img {
      height: 0.14rem;
      width: 0.48rem;
    }
    .marquee_dian {
      height: 0.06rem;
      width: 0.06rem;
      border-radius: 0.03rem;
      background-image: linear-gradient(#ff4c02, #f9cbcb);
      position: absolute;
      right: 0.29rem;
      top: 0.14rem;
      opacity:0.6158;
    }
    .marquee_box {
      display: block;
      position: relative;
      height: 0.3rem;
      width: 76%;
      overflow: hidden;
    }
    .marquee_list {
      display: block;
      position: absolute;
      top: 0;
      left: 0;
    }
    .marquee_top {
      transition: all 0.5s;
      margin-top: -0.3rem;
    }
    .marquee_list li {
      height: 0.3rem;
      width: 2rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 0.3rem;
      font-size: 0.12rem;
      padding-left: 0.2rem;
      color: #848383;
    }
    .marquee_list li span {
      padding: 0 0.02rem;
    }
  }
  .content {
    height: 6.4rem;
    overflow-y: scroll;
    .header {
      height: 1.65rem;
      width: 100%;
      background-image: url("../../assets/background_sale.png");
      background-position: center;
      background-size: 100%;
      background-repeat: no-repeat;
      p {
        text-align: center;
        padding-top: 0.3rem;
        color: #1a2533;
        font-size: 0.18rem;
        font-weight: 500;
      }
    }
    .sj {
      padding: 0 0.35rem;
      margin-top: 0.22rem;
      margin-bottom: 0.08rem;
      ul {
        display: flex;
        justify-content: space-between;
        li {
          width: 0.5rem;
          text-align: center;
          img {
            height: 0.48rem;
            width: 0.5rem;
          }
          p {
            font-size: 0.12rem;
          }
          .text_r {
            color: #a9a9a9;
          }
          .text_r2 {
            color: #e55346;
          }
        }
      }
    }
    .list_a {
      padding: 0 0.15rem;
      margin-top: 0.1rem;
      padding-bottom: 0.7rem;
      ul {
        li {
          padding-top: 0.22rem;
          padding-bottom: 0.1rem;
          border-bottom: 0.01rem solid #eee;
          .diva {
            color: #1a2533;
            font-size: 0.16rem;
            display: flex;
            justify-content: space-between;
            span {
              img {
                margin-left: 0.1rem;
                height: 0.18rem;
                width: 0.18rem;
              }
            }
          }
          .divb {
            display: flex;
            flex-wrap: wrap;
            div {
              padding: 0.04rem 0.14rem;
              background: rgba(205, 226, 250, 0.38);
              margin: 0.1rem 0.1rem 0.03rem 0;
              border-radius: 0.03rem;
              color: #8c8c8c;
              position: relative;
              img {
                position: absolute;
                height: 0.13rem;
                width: 0.13rem;
                right: -0.04rem;
                top: -0.04rem;
              }
            }
          }
        }
      }
    }
    .bottom_mode {
      width: 100%;
      border-radius: 0.12rem 0.12rem 0 0;
      box-shadow: 0px -3px 6px 0px rgba(0, 0, 0, 0.2);
      .title {
        height: 0.43rem;
        border-radius: 0.06rem 0.06rem 0 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 0.21rem;
        border-bottom: 0.01rem solid #eee;
        .text_1 {
          height: 0.11rem;
          width: 0.11rem;
          margin-top: -0.1rem;
          img {
            height: 200%;
            width: 200%;
          }
        }
        .text_2 {
          color: #1a2533;
          font-size: 0.14rem;
          font-weight: 500;
        }
        .text_3 {
          color: #e82716;
          font-size: 0.14rem;
          font-weight: 500;
        }
      }
      .text_content {
        margin-top: 0.19rem;
        margin-bottom: 0.3rem;
        ul {
          display: flex;
          flex-wrap: wrap;
          li {
            height: 0.3rem;
            width: 0.96rem;
            border-radius: 0.06rem;
            border: 1px solid #eee;
            margin: 0 0.06rem 0.14rem 0.13rem;
            text-align: center;
            line-height: 0.3rem;
            color: #a9a9a9;
            font-size: 0.16rem;
          }
          .active {
            background-color: #e9eff8;
            color: #1a2533;
          }
        }
      }
    }
    .fish_box {
      height: 0.55rem;
      width: 0.55rem;
      border-radius: 50%;
      position: absolute;
      right: 0.17rem;
      bottom: 1.03rem;
      z-index: 2;
      box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.3);
      .generate_a {
        height: 0.55rem;
        width: 0.55rem;
        border-radius: 50%;
        background-image: url("../../assets/fish.png");
        background-position: center;
        background-repeat: no-repeat;
      }
      .no {
        transition: all 10s;
      }
      .ok {
        transform: rotate(-9000deg);
        transition: all 10s;
      }
      .text_no1 {
        height: 0.3rem;
        width: 0.21rem;
        position: absolute;
        top: 0.13rem;
        left: 0.15rem;
        background-image: url("../../assets/text_2.png");
        background-position: center;
        background-repeat: no-repeat;
      }
    }
  }

  .footer {
    position: fixed;
    bottom: 0;
    height: 0.49rem;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    background: #fff;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.05);
    .out_1 {
      width: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      .in_1 {
        img {
          margin: 0 auto;
          height: 0.24rem;
          width: 0.24rem;
        }
        p {
          margin: 0 auto;
          font-size: 0.1rem;
          font-weight: 500;
        }
        .modela {
          height: 0.65rem;
          width: 0.65rem;
          border-radius: 50%;
          position: absolute;
          bottom: 0.16rem;
          left: 50%;
          margin-left: -0.32rem;
          display: flex;
          justify-content: center;
          align-items: center;
          background-color: #fbf8f8;
          img {
            height: 0.7rem;
            width: 0.7rem;
          }
        }
      }
    }
  }
}
</style>
